< previous page page_611 next page >

Page 611
0611-01.jpg
Figure 15.8.
The results of the 
UPDATE query with a WHERE clause.
Creating Make Table Queries Using the SELECT_INTO_FROM Statement
The SELECT_INTO_FROM statement allows you to create entirely new tables, complete with data from existing tables. This is called a Make Table query because it enables you to make a new table. The difference between Make Table queries and the CREATE TABLE statement is that you use the Make Table query to copy both the table structure and the data within the table from an already existing table. Because the Make Table query is really just a form of a SELECT statement, you can use all the clauses valid for a SELECT statement when copying data tables, including WHERE, ORDER BY, GROUP BY, and HAVING.
Make Table queries are excellent for making backup copies of your data tables. You can also create static read-only tables for reporting and reviewing purposes. For example, you can create a Make Table query that summarizes sales for the period and save the results in a data table that can be accessed for reports and on-screen displays. Now you can provide summary data to your users without giving them access to the underlying transaction tables. This can improve overall processing speed and help provide data security, too.
The basic form of the Make Table query is
SELECT field1, field2 INTO DestinationTable FROM SourceTable;

 
< previous page page_611 next page >

If you like this book, buy it!